;;;;;;;;;;;;;;;;;;;;;;;;;;Please don't edit this.;p~mystical/thermal_
; Replace /channel with /open.channels  
menu menubar {
  Channal Options:/dialog -md channels channels
}

alias open.channels {
  if ( $chr(35) !isin $active ) { 
    echo 12 -a Error; please reload 
    halt
  }
  elseif ( $dialog(channels) != $null )  { 
    dialog -v channels channels 
  }
  if ( $chan($active).banlist == $false ) {   
    mode $active +b
    echo 12 -a Error; please reload 
    halt  
  }
  if ( $chan($active).banlist == $true ) { 
    echo 12 -a Retrieving Channel Info...
    dialog -m channels channels 
    halt
  }
}
dialog channels {
  title "Mystical central vs2.5"
  size -1 -1 380 305
  tab "Channel", 1, 6 3 370 265
  check "&Invite Only", 35, 16 96 100 15, group tab 1
  check "&Limit to:", 40, 16 116 60 15, group tab 1
  edit "", 42, 76 114 35 19, tab 1 autohs
  text "users", 43, 116 116 30 15, tab 1
  check "&Private", 45, 16 136 70 15, group tab 1
  check "&Secret", 50, 16 156 65 15, group tab 1
  check "&Key:", 55, 16 176 40 15, group tab 1
  edit "", 60, 61 174 75 19, tab 1
  check "&Moderated", 65, 16 196 70 15, group tab 1
  check "&No external messages", 70, 16 216 125 15, group tab 1
  check "Only ops change &Topic", 75, 16 236 130 15, group tab 1
  tab "Web-net", 2
  check "&No Ctcp", 110, 15 87 100 15, group tab 2
  check "No &Color", 115, 15 103 110 15, group tab 2
  check "No Nic&k Change", 120, 15 119 100 15, group tab 2
  check "&Registered Channel", 125, 15 135 120 15, group tab 2
  text "(Cannot be Changed)", 130, 28 159 110 15, tab 2
  text "", 9, 45 33 300 15
  text "T&opic:", 10, 11 53 30 15
  edit "", 20, 45 51 315 19, autohs
  box "Channel Modes:", 30, 10 73 155 185
  text "", 80, 200 71 130 15, group
  list 85, 170 85 190 150, extsel hsbar vsbar
  button "&Apply", 90, 172 240 56 18, ok
  button "&Unban", 95, 247 240 51 18
  button "&Cancel", 100, 315 240 45 18, cancel
  box "", 3, 150 266 76 38
  button "Exit", 4, 158 279 61 19
}
on 1:dialog:channels:sclick:90: {
  if ( $did(35).state == 1 ) && ( i !isincs $gettok($chan($active).mode,1,32) ) { mode $active +i }
  if ( $did(35).state == 0 ) && ( i isincs $gettok($chan($active).mode,1,32) ) { mode $active -i }
  if ( $did(40).state == 1 ) && ( l !isincs $gettok($chan($active).mode,1,32) ) { mode $active +l $did(42).text }  
  if ( $did(40).state == 0 ) && ( l isincs $gettok($chan($active).mode,1,32) ) { mode $active -l $did(42).text }
  if ( $did(45).state == 1 ) && ( p !isincs $gettok($chan($active).mode,1,32) ) { mode $active +p }
  if ( $did(45).state == 0 ) && ( p isincs $gettok($chan($active).mode,1,32) ) { mode $active -p }
  if ( $did(50).state == 1 ) && ( s !isincs $gettok($chan($active).mode,1,32) ) { mode $active +s }
  if ( $did(50).state == 0 ) && ( s isincs $gettok($chan($active).mode,1,32) ) { mode $active -s }
  if ( $did(55).state == 1 ) && ( k !isincs $gettok($chan($active).mode,1,32) ) { mode $active +k $did(60).text }
  if ( $did(55).state == 0 ) && ( k isincs $gettok($chan($active).mode,1,32) ) { mode $active -k $did(60).text }
  if ( $did(65).state == 1 ) && ( m !isincs $gettok($chan($active).mode,1,32) ) { mode $active +m }
  if ( $did(65).state == 0 ) && ( m isincs $gettok($chan($active).mode,1,32) ) { mode $active -m }
  if ( $did(70).state == 1 ) && ( n !isincs $gettok($chan($active).mode,1,32) ) { mode $active +n }
  if ( $did(70).state == 0 ) && ( n isincs $gettok($chan($active).mode,1,32) ) { mode $active -n }
  if ( $did(75).state == 1 ) && ( t !isincs $gettok($chan($active).mode,1,32) ) { mode $active +t }
  if ( $did(75).state == 0 ) && ( t isincs $gettok($chan($active).mode,1,32) ) { mode $active -t }
  if ( $did(110).state == 0 ) && ( e isincs $gettok($chan($active).mode,1,32) ) { mode $active -e }
  if ( $did(110).state == 1 ) && ( e !isincs $gettok($chan($active).mode,1,32) ) { mode $active +e }
  if ( $did(115).state == 0 ) && ( c isincs $gettok($chan($active).mode,1,32) ) { mode $active -c }
  if ( $did(115).state == 1 ) && ( c !isincs $gettok($chan($active).mode,1,32) ) { mode $active +c }
  if ( $did(120).state == 0 ) && ( d isincs $gettok($chan($active).mode,1,32) ) { mode $active -d }
  if ( $did(120).state == 1 ) && ( d !isincs $gettok($chan($active).mode,1,32) ) { mode $active +d }
  if ( $did(20).edited == $true ) { topic $active $did(20).text }
}

on 1:dialog:channels:init:0: {
  banlistcheck
  if ( $banlist($active,0) == 0 ) { did -b channels 95 }
  if ( $me isop $active ) { did -fa channels 9 You are a Channel Operator and can change these settings }
  elseif ( $me !isop $active ) && ( t !isincs $gettok($chan($active).mode,1,32) ) { did -fa channels 9 You are not a Channel Operator and can only change the topic }
  elseif ( $me !isop $active ) && ( t isincs $gettok($chan($active).mode,1,32) ) { did -fa channels 9 You are not a Channel Operator and cannot change these settings }
  if ( r isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 125 }
  if ( r !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 125 }
  did -b channels 125
  did -b channels 130
  if ( i isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 35 }
  if ( i !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 35 }
  if ( l isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 40 } 
  if ( l !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 40 }
  if ( p isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 45 }
  if ( p !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 45 }
  if ( s isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 50 }
  if ( s !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 50 }
  if ( k isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 55 }
  if ( k !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 55 }
  if ( m isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 65 }
  if ( m !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 65 }
  if ( n isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 70 }
  if ( n !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 70 }
  if ( t isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 75 }
  if ( t !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 75 }
  if ( e isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 110 }
  if ( e !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 110 }
  if ( c isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 115 }
  if ( c !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 115 }
  if ( d isincs $gettok($chan($active).mode,1,32) ) { did -fc channels 120 }
  if ( d !isincs $gettok($chan($active).mode,1,32) ) { did -fu channels 120 }
  did -fa channels 20 $chan($active).topic 
  did -fa channels 42 $chan($active).limit 
  did -fa channels 60 $chan($active).key 
  did -fa channels 80 $active &ban list
  if ( $me !isop $active ) { 
    did -b channels 42 
    did -b channels 60 
    did -b channels 35
    did -b channels 40 
    did -b channels 45
    did -b channels 50
    did -b channels 55
    did -b channels 65
    did -b channels 70
    did -b channels 75
    did -b channels 95
    did -b channels 110
    did -b channels 115
    did -b channels 120
  }
  if ( $me !isop $active ) && ( t isincs $gettok($chan($active).mode,1,32) ) { did -m channels 20 }
}

on 1:dialog:channels:sclick:95:{
  if ( $did(35).state == 1 ) && ( i !isincs $gettok($chan($active).mode,1,32) ) { mode $active +i }
  if ( $did(35).state == 0 ) && ( i isincs $gettok($chan($active).mode,1,32) ) { mode $active -i }
  if ( $did(40).state == 1 ) && ( l !isincs $gettok($chan($active).mode,1,32) ) { mode $active +l $did(42).text }  
  if ( $did(40).state == 0 ) && ( l isincs $gettok($chan($active).mode,1,32) ) { mode $active -l $did(42).text }
  if ( $did(45).state == 1 ) && ( p !isincs $gettok($chan($active).mode,1,32) ) { mode $active +p }
  if ( $did(45).state == 0 ) && ( p isincs $gettok($chan($active).mode,1,32) ) { mode $active -p }
  if ( $did(50).state == 1 ) && ( s !isincs $gettok($chan($active).mode,1,32) ) { mode $active +s }
  if ( $did(50).state == 0 ) && ( s isincs $gettok($chan($active).mode,1,32) ) { mode $active -s }
  if ( $did(55).state == 1 ) && ( k !isincs $gettok($chan($active).mode,1,32) ) { mode $active +k $did(60).text }
  if ( $did(55).state == 0 ) && ( k isincs $gettok($chan($active).mode,1,32) ) { mode $active -k $did(60).text }
  if ( $did(65).state == 1 ) && ( m !isincs $gettok($chan($active).mode,1,32) ) { mode $active +m }
  if ( $did(65).state == 0 ) && ( m isincs $gettok($chan($active).mode,1,32) ) { mode $active -m }
  if ( $did(70).state == 1 ) && ( n !isincs $gettok($chan($active).mode,1,32) ) { mode $active +n }
  if ( $did(70).state == 0 ) && ( n isincs $gettok($chan($active).mode,1,32) ) { mode $active -n }
  if ( $did(75).state == 1 ) && ( t !isincs $gettok($chan($active).mode,1,32) ) { mode $active +t }
  if ( $did(75).state == 0 ) && ( t isincs $gettok($chan($active).mode,1,32) ) { mode $active -t }
  if ( $did(110).state == 1 ) && ( e !isincs $gettok($chan($active).mode,1,32) ) { mode $active +e }
  if ( $did(110).state == 0 ) && ( e isincs $gettok($chan($active).mode,1,32) ) { mode $active -e }
  if ( $did(115).state == 1 ) && ( c !isincs $gettok($chan($active).mode,1,32) ) { mode $active +c }
  if ( $did(115).state == 0 ) && ( c isincs $gettok($chan($active).mode,1,32) ) { mode $active -c }
  if ( $did(120).state == 1 ) && ( d !isincs $gettok($chan($active).mode,1,32) ) { mode $active +d }
  if ( $did(120).state == 0 ) && ( d isincs $gettok($chan($active).mode,1,32) ) { mode $active -d }
  if ( $did(20).edited == $true ) { topic $active $did(20).text }
  set %totalsel $did(channels,85,0).sel
  set %sel 1
  :loop
  if (%sel > %totalsel)  { dialog -c channels }
  else {
    mode $active -b $did(85,$did(85,%sel).sel) 
    inc %sel 1 
    goto loop 
  }
}
alias banlistcheck {
  set %banlistcheck 0 
  :loop  
  if ( %banlistcheck < $banlist($active,0) ) { 
    inc %banlistcheck 
    did -iz channels 85 1 $banlist($active,%banlistcheck) $str($chr(160),6) $chr(40) $+ $banlist($active,%banlistcheck).by $+  $+ $chr(44) $banlist($active,%banlistcheck).date $+ $chr(41) 
    goto loop  
  }
}
